﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LaughingDog.GameObjects;
using Microsoft.Xna.Framework;
using FarseerGames.FarseerPhysics.Factories;
using LaughingDog.Managers;

namespace LaughingDog.Components
{
    public class FixedRevoluteJoint : Joint
    {
        private FarseerGames.FarseerPhysics.Dynamics.Joints.FixedRevoluteJoint mFixedRevoluteJoint = null;

        /// <summary>
        /// Gets or sets the the anchor of the joint in world coordinates.
        /// </summary>
        public Vector2 Anchor { get { return mFixedRevoluteJoint.Anchor; } set { mFixedRevoluteJoint.Anchor = value; } }
   
        /// <summary>
        /// Gets or sets the maximum torque the RigidBodies will use.
        /// </summary>
        public Single MaxImpulse { get { return mFixedRevoluteJoint.MaxImpulse; } }

        /// <summary>
        /// Creates an instance of a FixedRevoluteJoint component.
        /// </summary>
        /// <param name="gameObject">The GameObject this component is attached to.</param>
        public FixedRevoluteJoint(GameObject gameObject)
            : base(gameObject)
        {
            mFixedRevoluteJoint = JointFactory.Instance.CreateFixedRevoluteJoint(PhysicsManager.Instance.Simulator, GameObject.RigidBody.Body, GameObject.RigidBody.Position);
            mJoint = mFixedRevoluteJoint;                    
        }
    }
}
